#ifndef LEVELMANAGER_H_
#define LEVELMANAGER_H_

#include <stdio.h>
#include "TextureManager.h"
#include "MaterialManager.h"
#include "AbrahamLincoln.h"
#include "ObjectList.h"
#include "StringList.h"
#include "Camera.h"
#include "Border.h"
#include "Vector2D.h"
#include "SpriteList.h"
#include "SupplyBag.h"
#include "Dictionary.h"

class LevelManager
{
	
	public:
	TextureManager textureManager;
	MaterialManager materialManager;
	LevelManager();
	~LevelManager();
	void LoadLevel(const char * fileName, Dictionary * gameState, AbrahamLincoln ** player, Camera ** camera, Border ** border, ObjectList ** objectList, ObjectList ** featureList, StringList ** stringList, SpriteList ** spriteList, SupplyBag * supplyBag);
	char * GetNextTag(FILE * fptr);
	char * GetNextElement(char * tag, int * pos);
	int GetElementType(char * name);
	int GetObjectType(char * name);
	int GetMaterialType(char * name);
	int GetEnemyType(char * name);
	int GetPickupType(char * name);
	int GetCharacterType(char * name);
	
	//Pickup Tags
	void HandlePickupTag(SpriteList ** spriteList, char * tag, int pos);
	void HandleGrenadeTag(SpriteList ** spriteList, char * tag, int pos);
	
	//Environment Tags
	void HandleBackgroundTag(Camera ** camera, char * tag, int pos);
	void HandleMaterialTag(char * tag, int pos);
	
	//Object Tags
	void HandleBorderTag(Border ** border, char * tag, int pos);
	void HandlePlayerTag(Camera ** camera, AbrahamLincoln ** abe, SupplyBag * supplyBag, char * tag, int pos);
	void HandleObjectTag(Dictionary * gameState, ObjectList ** objectList, ObjectList ** featureList, StringList ** stringList, char * tag, int pos);
	void HandleBaseObjectTag(ObjectList ** objectList, ObjectList ** featureList, char * tag, int pos);
	void HandlePinnedObjectTag(ObjectList ** objectList, char * tag, int pos);
	void HandleTranslatingObjectTag(ObjectList ** objectList, char * tag, int pos);
	void HandleConditionalTranslatingObjectTag(Dictionary * gameState, ObjectList ** objectList, char * tag, int pos);
	void HandleRopedObjectTag(ObjectList ** objectList, StringList ** stringList, char * tag, int pos);
	void HandleNpcObjectTag(ObjectList ** objectList, char * tag, int pos);
	void HandleToggleObjectTag(Dictionary * gameState, ObjectList ** objectList, char * tag, int pos);
	void HandlePressureButtonObjectTag(Dictionary * gameState, ObjectList ** objectList, char * tag, int pos);
	
	//Character Tags (NPC and Enemy 2.0)
	void HandleCharacterTag(ObjectList ** objectList, AbrahamLincoln * player, char * tag, int pos);
	void HandleBasicCharacterTag(ObjectList ** objectList, AbrahamLincoln * player, char * tag, int pos);
	
	//Enemy Tags
	void HandleEnemyTag(ObjectList ** objectList, AbrahamLincoln * player, char * tag, int pos);
	void HandleBasicEnemyTag(ObjectList ** objectList, AbrahamLincoln * player, char * tag, int pos);
	void HandleFrogEnemyTag(ObjectList ** objectList, AbrahamLincoln * player, char * tag, int pos);
	void HandleFlowerEnemyTag(ObjectList ** objectList, AbrahamLincoln * player, char * tag, int pos);
	Vector2D ReadCoordinate(char * element);
	int ReadInt(char * element);
	float ReadFloat(char * element);
	Vector2D ReadNextCoordinate(char * tag, int * pos);
	int ReadNextInt(char * tag, int * pos);
	float ReadNextFloat(char * tag, int * pos);
	char * ReadNextString( char * tag, int * pos);
	Material * ReadNextMaterial(char * tag, int * pos);
	Vector2D * ReadNextVectorArray(int numVertices, char * tag, int * pos);
	Rope * ReadNextRope(char * tag, int * pos);
	ParallaxLayer ReadNextParallaxLayer(char * tag, int * pos);
};
#endif /*LEVELMANAGER_H_*/
